package com.itheima.homework04;

import java.io.*;
import java.net.Socket;

public class Client {
    public static void main(String[] args) throws IOException {
        System.out.println("————————————————————————————客户端启动————————————————————-");

        Socket socket = new Socket("127.0.0.1",6666);
        FileOutputStream fos = new FileOutputStream("d:/test/p.png");
        InputStream is = socket.getInputStream();
        byte[] buf = new byte[1024];
        int len = -1;
        while ((len = is.read(buf)) != -1) {
            fos.write(buf,0,len);
        }
        socket.close();
        fos.close();



    }
}
